package cn.wsalix.finance.entity;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.Past;

import lombok.Data;
import lombok.EqualsAndHashCode;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.validator.constraints.Email;

import cn.anlaser.entity.SimpleEntity;
import cn.wsalix.admin.entity.SysUser;
import cn.wsalix.type.GenderEnum;

/**
 * @author jskyme
 * 客户 通讯录
 */
@Entity
@DynamicInsert @DynamicUpdate
@Table(name = "CUSTOMER")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Data
@EqualsAndHashCode(callSuper=false)
public class Customer extends SimpleEntity  {

	private static final long serialVersionUID = 1866474821139185112L;
	private String nativePlace;// 籍贯
	private String realname;// 真实姓名
	@Past
	private Date birthday;// 
	private String birthplace;
	private String permanentResidence;//常住地
	private String dept;//单位
	private String duty;	//职务
	private String wealth;//供需资源
	private String liking;//爱好
	
	private String phone;//手机
	private String weixin;//手机
	private String qq;//手机
	
	@Email
	private String email;//电子邮箱
	private String address;
	private GenderEnum gender;
	private String identityCard;//身份证号


	@ManyToOne(cascade = CascadeType.MERGE, optional = true, fetch = FetchType.LAZY)
	@JoinColumn(foreignKey = @ForeignKey(name = "FK_CUSTOMER_USER"), name = "USER_ID")
	private SysUser owner;
/*	@OneToMany(cascade = CascadeType.MERGE, fetch = FetchType.LAZY, mappedBy = "customer")
	private Set<CreditCard> creditCards;*/	
}
